import {getBaseUrl,requestUtil,getUserProfile,getWxLogin} from '../utils/requestUtils';
import regeneratorRuntime, { async } from '../lib/runtime/runtime';


//获取当月总支出
export const accountPayApi = () =>{
	return new Promise((resolve, reject) => {
	    requestUtil({
	        url: `/zj/user/accountPay`,
	        method: 'get',
	    }).then((res) => {
	        resolve(res)
	    }).catch((err) => {
	        reject(err)
	    })
	})
}

//获取当月总支出
export const accountGetApi = () =>{
	return new Promise((resolve, reject) => {
	    requestUtil({
	        url: `/zj/user/accountGet`,
	        method: 'get',
	    }).then((res) => {
	        resolve(res)
	    }).catch((err) => {
	        reject(err)
	    })
	})
}

export const zListApi = (data) =>{
	return new Promise((resolve, reject) => {
	    requestUtil({
	        url: '/zj/user/zlist',
	        method: 'post',
			  data:data
	    }).then((res) => {
	        console.log(res.data)
	        resolve(res)
	    }).catch((err) => {
	        reject(err)
	    })
	})
}
export const zhangByIdApi = (id) =>{
	return new Promise((resolve, reject) => {
	    requestUtil({
	        url: `/zj/user/findZhangById/${id}`,
	        method: 'get',
	    }).then((res) => {
	        console.log(res.data)
	        resolve(res)
	    }).catch((err) => {
	        reject(err)
	    })
	})
}

export const updateAccountApi = (data) => {
	return new Promise((resolve, reject) => {
		requestUtil({
			url: '/zj/user/',
			method: 'put',
			data: data
		}).then((res) => {
			console.log(res.data)
			resolve(res)
		}).catch((err) => {
			reject(err)
		})
	});
}

export const deleteAccountByidApi = (id) =>{
	return new Promise((resolve, reject) => {
	    requestUtil({
	        url: `/zj/user/deleteAccountByid/${id}`,
	        method: 'get',
	    }).then((res) => {
	        console.log(res.data)
	        resolve(res)
	    }).catch((err) => {
	        reject(err)
	    })
	})
}



